<?php
/**
 * MY_Controller Class
 * @package mobi.application.modules
 * @author xoannt
 */
class MY_Controller extends CI_Controller {
    protected $data = array();
/**
 * construct 
 * 
 * @access public
 */
    public function __construct() {
        parent::__construct();
        $this->load->library("my_form_validation");
        $this->load->library("check_form");
       
        
    }
/**
 * load layout admin site
 * 
 * @access public
 * @param string $template path file
 * @param array $data 
 */
    public function layout($template = '',$data=array())
    {
        $username = $this->session->userdata('username');
        if(!isset($username) || $username =='') 
        {
            redirect("admin/login");  
        }
        
        $data['baseURL'] = base_url();
        $this->load->view('layout/top.php',$data);
        if($template != '')
        {
            $this->load->view($template,$data);
        }
        $this->load->view('layout/right.php',$data);
    }
/**
 * load layout home site
 * 
 * @access public
 * @param string $template path file
 * @param array $data 
 */
    public function layout_home($template = '',$data=array())
    {
        
        
        $data['session_p'] = 0;
	if(!$this->session->userdata('jquery_popup'))
        {
                $data['session_p'] = 1;
		$this->session->set_userdata('jquery_popup', 'jQuery Popup');
                
	}
	
        $data['baseURL'] = base_url();
        $data['brand'] = $this->brand_home_model->list_brand();
        $data['category'] = $this->cate_home_model->list_cate();
        $data['menu'] = $this->cate_home_model->show_menu($data['category'],0);
        
        $data['slider'] = $this->slider_home_model->join_tbls();
        $this->load->view('layout/top.php',$data);
        if($template != '')
        {
            $this->load->view($template,$data);
        }
        $this->load->view('layout/right.php',$data);
    }
}
